This notebook explores the Google+ Photos, image recognition feature.

Google+ Photos is one of the most advanced, easily accessable, image recognition projects I have found online. The interested reader might want to learn more at Android Police or Mashable.

This feature was quite tempting to me when I heard of it, and I decided to upload my entire photo archive of about 3,000 photos to google plus. (All on private settings, only I can see them, and I took all of the photos, they have not existed on the internet anywhere else) I take a lot of cat photos.

Overall the Image Recognition features seem to be working quite well. Until I ask for my pictures without cats.

To see this, lets first look at the top 5 results for cats.


In [16]:
%pylab inline
from scipy.signal import correlate2d
cats = []
not_cats = []
cats.append( imread('imgs/cats/1.png') )
cats.append( imread('imgs/cats/2.png') )
cats.append( imread('imgs/cats/3.png') )
cats.append( imread('imgs/cats/4.png') )
cats.append( imread('imgs/cats/5.png') )
not_cats.append( imread('imgs/notcats/1.png') )
not_cats.append( imread('imgs/notcats/2.png') )
not_cats.append( imread('imgs/notcats/3.png') )
not_cats.append( imread('imgs/notcats/4.png') )
not_cats.append( imread('imgs/notcats/5.png') )
plt.imshow(cats[0])


Populating the interactive namespace from numpy and matplotlib
Out[16]:
<matplotlib.image.AxesImage at 0x10efe8d90>

In [17]:
plt.imshow(cats[1])


Out[17]:
<matplotlib.image.AxesImage at 0x10ec69350>

In [18]:
plt.imshow(cats[2])


Out[18]:
<matplotlib.image.AxesImage at 0x10efb88d0>

In [19]:
plt.imshow(cats[3])


Out[19]:
<matplotlib.image.AxesImage at 0x10ecff810>

In [20]:
plt.imshow(cats[4])


Out[20]:
<matplotlib.image.AxesImage at 0x110b08050>

Three of the top results for 'cat' are actually photos of the back of my dog. Now for the top 5 image recognition images for the query 'not cat'.


In [21]:
plt.imshow(not_cats[0])


Out[21]:
<matplotlib.image.AxesImage at 0x110e40850>

In [22]:
plt.imshow(not_cats[1])


Out[22]:
<matplotlib.image.AxesImage at 0x111ab2090>

In [23]:
plt.imshow(not_cats[2])


Out[23]:
<matplotlib.image.AxesImage at 0x111d45890>

In [24]:
plt.imshow(not_cats[3])


Out[24]:
<matplotlib.image.AxesImage at 0x112052a90>

In [25]:
plt.imshow(not_cats[4])


Out[25]:
<matplotlib.image.AxesImage at 0x112548090>

This time the result is five photos of cats. Three photos of my cat, and two photos of my brother's cat, which is somewhat similar to my cat... How does this correspond to a not cat?


In [26]:
not_cats[0] = not_cats[0].astype(float).sum(axis=-1)/3
not_cats[0] = where(not_cats[0] > 0.8, 1, -1)
imshow(not_cats[0], cmap=cm.gray, interpolation='nearest')


Out[26]:
<matplotlib.image.AxesImage at 0x1127440d0>

In [27]:
not_cats[1] = not_cats[1].astype(float).sum(axis=-1)/3
not_cats[1] = where(not_cats[1] > 0.8, 1, -1)
imshow(not_cats[1], cmap=cm.gray, interpolation='nearest')


Out[27]:
<matplotlib.image.AxesImage at 0x112f8ee10>

In [ ]:
cc = correlate2d( not_cats[0], not_cats[1] )
imshow(cc)
colorbar()
gcf().set_figheight(8)

In [0]: